From: Miroslav Rezanina Date: Thu, 17 Jan 2013 13:53:07 +0000 (+0000) Subject: Fix pygrub handling non-default entry X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~7421 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=0289e710ca443cd4d8698bcac9203c194e764510;p=xen.git Fix pygrub handling non-default entry If we pass 0 as pygrub --entry argument (i.e. we want to boot first item), default value is used instead. This is dueto wrong check for range of allowed values of index - 0 is index of first item. Signed-off-by: Miroslav Rezanina Acked-by: Matt Wilson Acked-by: Ian Campbell Committed-by: Ian Campbell --- diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub index 1845485a04..eedfdb2fbf 100644 --- a/tools/pygrub/src/pygrub +++ b/tools/pygrub/src/pygrub @@ -613,7 +613,7 @@ def run_grub(file, entry, fs, cfg_args): # set the entry to boot as requested if entry is not None: idx = get_entry_idx(g.cf, entry) - if idx is not None and idx > 0 and idx < len(g.cf.images): + if idx is not None and idx >= 0 and idx < len(g.cf.images): sel = idx if sel == -1: